#ifndef __FORMWINDOWW_H_
#define __FORMWINDOWW_H_

#include <QtGui/QWidget>
#include <QtCore/QObject>
#include <QtCore/QPoint>

#include "widgethost.h"

QT_FORWARD_DECLARE_CLASS(QDesignerFormEditorInterface)
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface)
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowManagerInterface)
QT_FORWARD_DECLARE_CLASS(QFile)

class FormWindowW : public SharedTools::WidgetHost
{
    Q_OBJECT
    Q_CLASSINFO("ClassID", "{1aeb98bb-64e6-401b-89c1-498fe73749e2}")
    Q_CLASSINFO("InterfaceID", "{5e042145-9e00-43a4-a703-1428a6579ceb}")
    Q_CLASSINFO("EventsID", "{907545ed-faa5-44e0-96a3-8ad36522979c}")
    Q_CLASSINFO("ToSuperClass", "FormWindowW")

public:
    FormWindowW(QWidget *parent = 0);
    ~FormWindowW();

    void signalChange(int id)
    {
    	Q_EMIT actionChanged(id);
    }

    bool eventFilter(QObject *watched, QEvent *e);

    void setFont(const QFont &) { }

public Q_SLOTS:
    QString pluginFailureString() const;
    void open(QString fileName);
    bool save();
    bool saveAs(QString fileName);
    bool isDirty();
    void close();
    void initialize();

    void setActiveFormWindow();
    void setObjectName(const QString &objectName);
    bool initializeJambiPlugins(const QString &jambiBase, const QString &jambiPluginPath, const QString &customWidgetClassPath, const QString &resourcePath, const QString &jvm);
    void updateJambiResourcePath(const QString &resourcePath);
    void updateCustomWidgetLocation(const QString &path);

    int actionCount();
    int staticActionCount();
    QString actionName(int id);
    QString actionToolTip(int id);
    void actionTrigger(int id);
    bool isEnabled(int id);

    int toolCount();
    QString toolName(int index);
    QString toolToolTip(int index);
    int currentTool();
    void setCurrentTool(int index);

/*protected:
    void mouseReleaseEvent ( QMouseEvent * e );*/

Q_SIGNALS:
    void actionChanged(int id);
    void checkActiveWindow();
    void resourceFilesChanged();
    void updateDirtyFlag();

private Q_SLOTS:
    void formSizeChanged(int w, int h);
    void formSelectionChanged();
    void formChanged();

private:
    bool save(QString fileName);
    QDesignerFormWindowManagerInterface *m_fwm;
    QDesignerFormEditorInterface *m_core;

    uint m_lastDirtyFlag : 1;
    uint m_initialized : 1;
};

#endif //__FORMWINDOWW_H_
